//
//  LocationVC.m
//  first
//
//  Created by 毕小强 on 16/12/7.
//  Copyright © 2016年 毕小强. All rights reserved.
//

#import "LocationVC.h"
@interface LocationVC ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView *mainTableView;
@property (nonatomic,strong)NSArray *dataArr;
@end

@implementation LocationVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.dataArr = [[NSUserDefaults standardUserDefaults] objectForKey:@"UserDefaultLocation"];
    // Do any additional setup after loading the view.
    self.mainTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight) style:UITableViewStylePlain];
    self.mainTableView.delegate = self;
    self.mainTableView.dataSource = self;
    self.mainTableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
    [self.view addSubview:_mainTableView];
    
}
#pragma mark UITableViewDelegate,UITableViewDataSource
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellID = @"cellID";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    if (self.dataArr.count != 0) {
        NSDictionary *dic = [self.dataArr objectAtIndex:indexPath.row];
        NSString *Str = [NSString stringWithFormat:@"%f %f %@",[dic[@"latitude"] doubleValue],[dic[@"longitude"] doubleValue],dic[@"time"]];
        cell.textLabel.text = Str;
    }
    return cell;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataArr.count;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
